<?php
/**
 * User: WL
 * Time: 12-10-13 - 上午9:14
 * File: list.inc.php
 * Project For ixdcw.com
 */
/**
 * 2013-4-1 Sameal add order by cityid an group level
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
require_once DT_INC.'/post.func.php';
ViewCheck::catExists() or Prompt::listNotFound();
ViewCheck::groupListPermission() or Prompt::noPermission();

$buildBase = array('catid', 'areaid', 'typeid', 'order', 'kw', 'ctp', 'bid', 'cid', 'mid', 'page','cen');


require_once DT_INC . '/search/listAuto.inc.php';


if (!empty($ARE)) {
	$mainarea=Xd_get_arealists($ARE);
} else {
	$mainarea[0] = get_mainarea(0);
}

$areaParentid = $ARE['parentid'];
if ($kw) {
	SearchCheck::length($kw);
	SearchCheck::timeLimit();
}


$condition = "{$table}.areaid!=0 and {$table}.amid!='' ";

// 地区搜索.
if ($areaid) {
	$condition .=  $ARE['child'] ? " AND {$table}.areaid IN (".$ARE['arrchildid'].") " : " AND {$table}.areaid=$areaid ";
}
if ($kw) {
	$condition .= " AND title LIKE '%$kw%'";
}
if (!empty($CAT)) {
	$condition .= ($CAT['child']) ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid=$catid ";
}
if ($typeid != 99 && array_key_exists($typeid, $TYPES)) {
	$condition .= " AND typeid=$typeid ";
}
$dorder  = array( $MOD['order'], $group['DESC'], $group['ASC'], 'addtime DESC', 'addtime ASC');
$order = isset( $order ) ? intval($order) : 3;
isset($order) && isset($dorder[$order]) or $order = 3;


	if ($ctp) {
		$condition .= " and arbid in (" . implode(',',array_keys($BRANDS)) . ")";
	}
	if ($bid) {
		$condition .= " and arbid like '%".$bid."%'";
	}

	if ($cid) {
		$condition .= " and arcid like '%".$cid."%'";
	}

	if ($mid) {
		$condition .= " and amid like '%".$mid."%'";
	}

$total = $db->count($table, $condition);

$do = new OwnersModule($moduleid);

if ($total) {
	$tags = $do->getList($condition,'edittime desc');

}


$seo_file = 'list';
include DT_INC.'/seo.inc.php';
include template('index', $module);

